/**
 * 工单相关和事件相关接口
 */
import axios from '../axios'
let url = axios.BASEURL
export default class events {
  /**
   * 事件部分
   */

  // 获取事件列表
  static async geteventList(params) {
    let res = await axios.post('/business/events/getEventList', params)
    return res.data
  }
  // 新增事件
  static async AddEvent(params) {
    let res = await axios.post('/business/events/insertEvent', params)
    return res.data
  }
  // 删除某条事件
  static async DeleteEvent(params) {
    let res = await axios.post(`/business/events/deleteEventLogic`, params)
    return res.data
  }
  // 修改某条事件
  static async UpdateEvent(params) {
    let res = await axios.post(`/business/events/updateEvent`, params)
    return res.data
  }
  // 查询事件详情
  static async EventDetail(id) {
    let res = await axios.get(`/business/events/getEventDetail?id=${id}`)
    return res.data
  }
  // 回复按钮
  static async replyhhhh(params) {
    let res = await axios.post(`/business/events/reply`, params)
    return res.data
  }
  // 报事状态修改
  static async updateEventsStatus(params) {
    let res = await axios.post(`/business/events/updateStatus`, params)
    return res.data
  }
  /**
   * 工单部分
   */
  // 获取工单列表
  static async getworkList(params) {
    let res = await axios.post('/business/order/getOrderList', params)
    return res.data
  }
  // 新增工单 
  static async Addwork(params) {
    let res = await axios.post('/business/order/insertOrder', params)
    return res.data
  }
  // 删除某条工单
  static async Deletework(params) {
    let res = await axios.post(`/business/order/deleteOrderLogic`, params)
    return res.data
  }
  // 修改某条工单
  static async Updatework(params) {
    let res = await axios.post(`/business/order/updateOrder`, params)
    return res.data
  }
  // 工单详情
  static async DetailWork(id) {
    let res = await axios.get(`/business/order/getOrderDetail?id=${id}`)
    return res.data
  }
  // 工单状态修改
  static async updateStatus(params) {
    let res = await axios.post(`/business/order/updateStatus`, params)
    return res.data
  }

  /**
   * 
   * 下拉部分
   */
  // 获取部门列表
  static async getDepartmentList(params) {
    let res = await axios.post(`/auth/department/getDepartmentList`, params)
    return res.data
  }
  // 获取部门id获取用户列表   错误
  // static async DepartmentByUser(id) {
  //   let res = await axios.get(`/auth/user/getUserListByDepId?depId=${id}`)
  //   return res.data
  // }
  // 获取用户列表
  static async getUserList(params) {
    let res = await axios.post(`/auth/user/getUserList`, { params })
    return res.data
  }
  // 根据所在房间获取该房间下的用户列表
  static async getRoomUserList(params) {
    let res = await axios.post(`/business/events/getBindingUser`, params)
    return res.data
  }
  // 获取机构列表
  static async getCompanyList(params) {
    let res = await axios.post(`/business/company/list`, params)
    return res.data
  }
  // 获取机关列表
  static async getAgencySelectData(type, name) {
    let res = await axios.get(`/business/agency/getAgencySelectData?type=${type}&name=${name}`)
    return res.data
  }
  // 获取小区列表
  static async getCellList(params) {
    let res = await axios.post(`/business/residentialQuarters/list`, params)
    return res.data
  }
  // 获取楼宇列表
  static async getBuildingList(params) {
    let res = await axios.post(`/business/building/list`, params)
    return res.data
  }
  // 获取楼宇列表
  static async getroomList(params) {
    let res = await axios.post(`/business/room/list`, params)
    return res.data
  }



  // 获取登录用户的下拉机构列表
  static async MygetCompanyListByLoginUser() {
    let res = await axios.get('/business/order/getCompanyListByLoginUser')
    return res.data
  }
  // 获取登录用户的一些工单用的信息
  static async MygetLoginDetail() {
    let res = await axios.get('/business/order/getLoginDetail')
    return res.data
  }

    // 获取服务人员列表
    static async myGetUserListByDepId(depId) {
      let res = await axios.get(`/business/order/getUserListByDepId?depId=${depId}`)
      return res.data
    }
}